/*
 * @Descripttion: 
 * @version: 
 * @Author: gengzhi
 * @Date: 2020-08-20 16:09:52
 * @LastEditors: gengzhi
 * @LastEditTime: 2020-08-20 16:12:54
 */
package domain

import "github.com/ixre/gof"

func HandleError(err error,src string)error{
	if err!=nil&&gof.CurrentApp.Debug(){
		gof.CurrentApp.Log().Panicln("[ Go2o][ Error] - ", err.Error())
	}
	return err
}

var _ error = &DomainError{}

type DomainError struct{
	Key string
	DefaultError string
}

func NewError(key string, msg string) *DomainError {
	return &DomainError{
		Key:          key,
		DefaultError: msg,
	}
}

func (this *DomainError) Error() string {
	return this.DefaultError
}

func (this *DomainError) Set(msg string) {
	this.DefaultError = msg
}